<style lang="less">
  .filltitle {
    text-align: center;
    line-height: 28px;
    margin-bottom: 20px;
    dt {
      font-size: 20px;
    }
    dd {
      font-size: 16px;
      color: #888;
    }
  }

  .w100 {
    width: 100%;
  }

  .login-wrap {
    padding: 0 0.3rem;
  }

  .orderLink {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 0;
    font-size: 14px
  }

  .tiper {
    color: #636363;
    text-align: center;
    margin-top: 20px;
  }
</style>
<template>
  <div class="contain">
    <div class="loader-base" v-if="showLoad">
      <div class="loader-wrap"></div>
    </div>
    <img src="@/assets/bg/ditie.jpg" style="width:100%">
    <div class="filltitle">
      <dl>
        <dt>大美武汉 童话地铁</dt>
        <dd>比赛获奖成绩查询</dd>
      </dl>
    </div>
    <ul class="login-wrap">
      <li class="displayflex">
        <span class="iconfont icon-account"></span>
        <div class="flex1 login-ipt"><input type="text" placeholder="姓名" v-model.trim="name" maxlength="4"></div>
        <span class="iconfont icon-del" v-if="name" @click="name=''"></span>
      </li>

      <div class="agbtn btn-info" style="display:block; height:45px; line-height:45px;"
           @click="goNext">
        确认并继续
      </div>
    </ul>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        showLoad: false,
        name: '',
      }
    },
    methods: {
      goNext() {
        if (this.name === "") {
          this.$vux.toast.show({
            type: "warn", //success, warn, cancel, text
            text: "请填写姓名"
          });
          return false;
        }
        let self = this;
        let query = {
          Author: self.name,
        };
        this.showLoad = true;
        this.Ajax.post("queryByAuthor", query).then(function (resp) {
          self.showLoad = false;
          if (resp.IsSuccess) {
            var str = '';
            for (var i = 0; i < resp.Datas.length; i++) {
              str += resp.Datas[i].name + ' '
            }
            self.$router.push({
              path: 'QueryResult',
              query: {
                name: str
              }
            })
          }
          else {
            self.$vux.toast.show({
              type: "warn", //success, warn, cancel, text
              text: "抱歉，没有查到"
            });
          }
        });
      }
    }
  }
</script>


